package com.corx.network.mysqlstorage.model;

import java.io.Serializable;
import java.util.*;

/**
 * 设备数据动态结构表
 *
 * @author gx
 * @version 1.0.0
 */
public class DeviceDataStructured implements Serializable {

    private final Map<String, Object> fields;

    public DeviceDataStructured(Map<String, Object> fields) {
        this.fields = new HashMap<>(fields);
    }

    public Long getId() {
        Object val = fields.get("id");
        return val != null ? (Long) val : null;
    }

    public void setId(Long id) {
        fields.put("id", id);
    }

    public String getDeviceId() {
        Object val = fields.get("device_id");
        return val != null ? (String) val : null;
    }

    public void setDeviceId(String deviceId) {
        fields.put("device_id", deviceId);
    }

    public void setModelId(Long modelId) {
        fields.put("model_id", modelId);
    }

    public Long getModelId() {
        Object val = fields.get("model_id");
        return val != null ? (Long) val : null;
    }

    public void setCreateTime(Date date) {
        fields.put("create_time", date);
    }

    public Date getCreateTime() {
        Object val = fields.get("create_time");
        return val != null ? (Date) val : null;
    }

    public Date getUpdateTime() {
        Object val = fields.get("update_time");
        return val != null ? (Date) val : null;
    }

    public void setUpdateTime(Date date) {
        fields.put("update_time", date);
    }


    public Object get(String key) {
        return fields.get(key);
    }

    public Set<String> fieldNames() {
        return fields.keySet();
    }

    public Map<String, Object> getAll() {
        return Collections.unmodifiableMap(fields);
    }
}
